package com.stox.ui.javafx.list.widget.menu;

import java.util.Locale;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.stox.dto.WatchList;
import com.stox.ui.javafx.list.client.WatchListClient;

@Component("addToWatchListMenu")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class AddToWatchListMenu extends WatchListMenu implements InitializingBean{

	@Autowired
	private WatchListClient watchListClient;
	
	@Autowired
	private ApplicationContext applicationContext;
	
	@Override
	public void afterPropertiesSet() throws Exception {
		WatchList watchList = new WatchList();
		watchList.setId(0l);
		watchList.setName(applicationContext.getMessage("AddToWatchList", null, Locale.getDefault()));
		setWatchList(watchList);
	}
	/*
	@Override
	public Collection<MenuItem> loadMenuItems() {
		List<MenuItem> menuItems = new LinkedList<MenuItem>();
		List<WatchList> watchLists = watchListClient.findByParentId(0l);
		if(null != watchLists && !watchLists.isEmpty()){
			for(WatchList watchListOne : watchLists){
				WatchListMenu watchListMenu = applicationContext.getBean(WatchListMenu.class);
				watchListMenu.setWatchList(watchListOne);
				menuItems.add(watchListMenu);
			}
		}
		return menuItems;
	}
*/
}
